package com.azxc.rapid.admin.config;

import de.codecentric.boot.admin.server.domain.entities.InstanceRepository;
import com.azxc.rapid.admin.notifier.CustomNotifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * AdminConfiguration
 */
@Configuration
public class AdminConfiguration {

	@Bean
	@ConditionalOnMissingBean
	@ConditionalOnProperty(value = "spring.boot.admin.notify.dingtalk.enabled", havingValue = "true")
	public CustomNotifier customNotifier(InstanceRepository repository) {
		return new CustomNotifier(repository);
	}

}
